package com.hnust.dao;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface CourseTargetDao {
	/*
	 * @Author Tonited
	 * @Description //TODO
	 * @Date 19:25 2020/10/29
	 * @Param [id, couId课程id, gradId对应毕业目标id, content内容,majId对应专业id]
	 * @return java.lang.Integer
	 **/
	@Insert("insert into course_target values (#{id}, #{content}, #{couId}, #{gradId},#{majId},${num})")
	@ResultType(Integer.class)
	Integer insertCourseTarget(String id, String couId, String gradId, String content,String majId,String num);


	/*
	 * @Author Tonited
	 * @Description //TODO 根据num和courseid获取CourseTargetId
	 * @Date 16:10 2020/10/30
	 * @Param [num, couId]
	 * @return java.lang.String
	 **/
	@Select("select cou_tar_id from course_target where num=#{num} and cou_id=#{couId}")
	@ResultType(String.class)
	String getCouTarIdByNumAndCourseId(String num, String couId);

	/*根据课程id删除课程目标*/
	@Delete("delete from course_target where cou_id=#{couId}")
	@ResultType(Boolean.class)
	Boolean deleteCouTarByCouId(@Param("couId")String couId);
}
